** Do file for Jansa, Joshua M. and Eve M. Ringsmuth.
** Resentment or Empowerment? Civic Education and the 
** Political Efficacy of Rural Individuals
** American Politics Rearch

** Last updated 09/18/2025

** descriptive statistics of sample **

* number of students completing both waves 
* note some did not complete key vars
	
tab obsType

* limit analyses to only students who completed both waves
* i.e., obsType==3 

tab section if obsType==3
tab instructor_final if obsType==3
tab semester if obsType==3

* overal response rate *
	* F22 enrollment=1872
	* S23 enrollment=1414
	* F23 enrollment=1892
	* S24 enrollment=1277
	* 6455 total enrollment for these four semesters
	* students completing both waves=2593
	* 2593/6455 = 0.4
	
tab female if obsType==3
tab minority if obsType==3
tab year_w1 if obsType==3
tab major_cas if obsType==3	
tab geog_w1 if obsType==3


* create and check key variables for analysis

* internal efficacy *

* these are combined into scales when processing survey data
* each semester. 
* ie_scale_w1 and ie_scale_w2 measure internal efficacy at wave 1
* and wave 2, respectively.
* Cronbach's alpha suggests the underlying items can be 
* scaled together reliably

alpha ie_issues_w1 ie_role_w1 ie_discussing_w1 ie_qualified_w1 ie_complicated_w1 if obsType==3
alpha ie_issues_w2 ie_role_w2 ie_discussing_w2 ie_qualified_w2 ie_complicated_w2 if obsType==3

* place-based resentment *

* take responses to each item at each wave and code based on
* response and student's rural or nonrural identity

gen pbResent1_w1 = 1 if geog_w1==1 & resent1_w1==2
replace pbResent1_w1 = 0 if geog_w1==0 & resent1_w1==2
replace pbResent1_w1 = 1 if geog_w1==0 & resent1_w1==1
replace pbResent1_w1 = 0 if geog_w1==1 & resent1_w1==1
replace pbResent1_w1 = 0 if resent1_w1==3

gen pbResent2_w1 = 1 if geog_w1==1 & resent2_w1==3
replace pbResent2_w1 = 0 if geog_w1==0 & resent2_w1==3
replace pbResent2_w1 = 1 if geog_w1==0 & resent2_w1==1
replace pbResent2_w1 = 0 if geog_w1==1 & resent2_w1==1
replace pbResent2_w1 = 0 if resent2_w1==2

gen pbResent3_w1 = 1 if geog_w1==1 & resent3_w1==2
replace pbResent3_w1 = 0 if geog_w1==0 & resent3_w1==2
replace pbResent3_w1 = 1 if geog_w1==0 & resent3_w1==1
replace pbResent3_w1 = 0 if geog_w1==1 & resent3_w1==1
replace pbResent3_w1 = 0 if resent3_w1==3

gen pbResent1_w2 = 1 if geog_w1==1 & resent1_w2==2
replace pbResent1_w2 = 0 if geog_w1==0 & resent1_w2==2
replace pbResent1_w2 = 1 if geog_w1==0 & resent1_w2==1
replace pbResent1_w2 = 0 if geog_w1==1 & resent1_w2==1
replace pbResent1_w2 = 0 if resent1_w2==3

gen pbResent2_w2 = 1 if geog_w1==1 & resent2_w2==3
replace pbResent2_w2 = 0 if geog_w1==0 & resent2_w2==3
replace pbResent2_w2 = 1 if geog_w1==0 & resent2_w2==1
replace pbResent2_w2 = 0 if geog_w1==1 & resent2_w2==1
replace pbResent2_w2 = 0 if resent2_w2==2

gen pbResent3_w2 = 1 if geog_w1==1 & resent3_w2==2
replace pbResent3_w2 = 0 if geog_w1==0 & resent3_w2==2
replace pbResent3_w2 = 1 if geog_w1==0 & resent3_w2==1
replace pbResent3_w2 = 0 if geog_w1==1 & resent3_w2==1
replace pbResent3_w2 = 0 if resent3_w2==3

* cronbach's alpha for pbResent_w1 (0.72)

alpha pbResent1_w1 pbResent2_w1 pbResent3_w1 if obsType==3

* cronbach's alpha for pbResent_w2 (0.72)

alpha pbResent1_w2 pbResent2_w2 pbResent3_w2 if obsType==3

* gen index of place-based resentment

gen pbResent_w1 = pbResent1_w1 + pbResent2_w1 + pbResent3_w1
gen pbResent_w2 = pbResent1_w2 + pbResent2_w2 + pbResent3_w2

label variable pbResent_w1 "Place-Based Resentment (Before)"
label variable pbResent_w2 "Place-Based Resentment (After)"

	

** Analysis **

* what are starting levels of efficacy? And how did they change over semester for rural vs nonrural students *

* compare internal efficacy w1 for rural vs. non

ttest ie_scale_w1 if obsType==3, by(geog_w1)

* compare internal efficacy w2 for rural vs. non

ttest ie_scale_w2 if obsType==3, by(geog_w1)

* test growth in efficacy for both rural and non

by geog_w1, sort : ttest ie_scale_w1 == ie_scale_w2 if obsType==3

* test whether rural or non rural students gained more efficacy
	* change in effiacy is indistinguishable for rural vs. non

ttest delta_ie if obsType==3, by(geog_w1)

* Generate Figure 1

graph bar (mean) ie_scale_w1 (mean) ie_scale_w2 if obsType==3, ytitle(`"Internal Efficacy"') legend(order(1 "Wave 1" 2 "Wave 2")) by(, graphregion(fcolor(white))) by(geog_w1) scheme(sj) graphregion(fcolor(white) lcolor(white))


* Were there differences in rural vs. non by parental education and socialization?

* parental education

* test whether first gen or nonfirst gen students gained more efficacy
* when compared to geographic peers
	
by geog_w1, sort : ttest delta_ie if obsType==3, by(parentEdu_w1)

* test whether rural or nonrural students gained more efficacy
* when compared to peers defined by parents education
	
by parentEdu_w1, sort : ttest delta_ie if obsType==3, by(geog_w1)

* and to report start and end values in Table 1, conduct the following ttests
by geog_w1, sort : ttest ie_scale_w1 if obsType==3, by(parentEdu_w1)
by geog_w1, sort : ttest ie_scale_w2 if obsType==3, by(parentEdu_w1)

* parental socialization

* test whether high or low parental political socialization students 
* gained more efficacy when compared to geographic peers
	
by geog_w1, sort : ttest delta_ie if obsType==3, by(pShigh)

* test whether rural or nonrural students gained more efficacy
* when compared to peers defined by parental socialization
	
by pShigh, sort : ttest delta_ie if obsType==3, by(geog_w1)

* and to report start and end values in Table 1, conduct the following ttests
by geog_w1, sort : ttest ie_scale_w1 if obsType==3, by(pShigh)
by geog_w1, sort : ttest ie_scale_w2 if obsType==3, by(pShigh)

* Were there differences in rural vs. non by pedagogy?

* test whether students exposed to active learning vs. traditional learning
* gained more efficacy when compared to geographic peers
	
by geog_w1, sort : ttest delta_ie if obsType==3, by(part_syll_dum)

* test whether rural or nonrural students gained more efficacy
* when compared to students exposed to similar pedagogical approaches
	
by part_syll_dum, sort : ttest delta_ie if obsType==3, by(geog_w1)

* Create Figure 2, panel one: non-rural

graph bar (mean) ie_scale_w1 (mean) ie_scale_w2 if obsType==3 & geog_w1==0, ytitle(`"Internal Efficacy"')  by(, title("Non-Rural")) legend(order(1 "Wave 1" 2 "Wave 2")) by(, graphregion(fcolor(white))) by(part_syll_dum) scheme(sj) graphregion(fcolor(white) lcolor(white))

graph save "panelone", replace

* Create Figure 2, panel two: rural

graph bar (mean) ie_scale_w1 (mean) ie_scale_w2 if obsType==3 & geog_w1==1, ytitle(`"Internal Efficacy"') by(, title("Rural")) legend(order(1 "Wave 1" 2 "Wave 2")) by(, graphregion(fcolor(white))) by(part_syll_dum) scheme(sj) graphregion(fcolor(white) lcolor(white))

graph save "paneltwo", replace

* Combine to create Figure 2

graph combine "panelone" "paneltwo", graphregion(fcolor(white) ifcolor(white))


* Who has resentment?

* at wave 1, both rural and nonrural have avg level of resentment greater than 0 at w1 (p<0.01)

by geog_w1, sort : ttest pbResent_w1 == 0 if obsType==3

* but rural students are significantly higher on resentment than non-rural at wave 1 (p<0.01)

ttest pbResent_w1 if obsType==3, by(geog_w1)

* at wave 2, both rural and non have avg level of resentment greater than 0 at w1 (p<0.01)
by geog_w1, sort : ttest pbResent_w2 == 0 if obsType==3

* but rural students significantly higher on resentment than non-rural (p<0.01)
ttest pbResent_w2 if obsType==3, by(geog_w1)

* place-based resentment increases slightly for both groups but dif is not statistically sig

by geog_w1, sort : ttest pbResent_w1 == pbResent_w2 if obsType==3


* and this patterns holds for individual questions as well

	* resent1 increases slightly for rural studnets (p=0.05), non-rural not sig
by geog_w1, sort : ttest pbResent1_w1 == pbResent1_w2 if obsType==3

	* change in resent2 not sig for both rural and non rural
by geog_w1, sort : ttest pbResent2_w1 == pbResent2_w2 if obsType==3

	* change in resent3 not sig for both rural and non rural
by geog_w1, sort : ttest pbResent3_w1 == pbResent3_w2 if obsType==3

* Create Figure 3

graph bar (mean) pbResent_w1 (mean) pbResent_w2 if obsType==3,  ytitle(`"Place-Based Resentment"') by(, ) legend(order(1 "Wave 1" 2 "Wave 2")) by(, graphregion(fcolor(white) lcolor(white))) by(geog_w1) scheme(sj) 


* Create and describe Figures A1 and A2 in Appendix

tab pbResent_w1 if obsType==3 & geog_w1==0 
tab pbResent_w1 if obsType==3 & geog_w1==1

tab pbResent_w2 if obsType==3 & geog_w1==0 
tab pbResent_w2 if obsType==3 & geog_w1==1  

histogram pbResent_w1 if obsType==3, discrete percent fcolor(gs8) lcolor(gs4) xtitle(`"Place-Based Resentment"') xlabel(0(1)3) by(, graphregion(fcolor(white))) by(geog_w1) subtitle(, fcolor(gs13))

graph save "w1resent", replace

histogram pbResent_w2 if obsType==3, discrete percent fcolor(gs8) lcolor(gs4) xtitle(`"Place-Based Resentment"') xlabel(0(1)3) by(, graphregion(fcolor(white))) by(geog_w1) subtitle(, fcolor(gs13))

graph save "w2resent", replace

graph combine "w1resent" "w2resent", graphregion(fcolor(white) ifcolor(white))


* Does resentment condition change in efficacy? 

* DV = change in internal effiacy (delta_ie)
* IV = resentment at wave 1 (pbResent_w1)
* model includes controls for student demographics and instructor dummy

reg delta_ie ie_scale_w1 i.pbResent_w1 geog_w1 female minority parentEdu_w1 ///
pShigh gpa_combo i.instructor_final ///
if obsType==3 & semester=="S24"

eststo m1

* students with highest level of resentment (3 out of 3) are less likely to
* grow in efficacy, controlling for other vars in model

* plot results using margins
* plot is Figure 6 in the paper
* note: values for control variables set at mean or modal values

margins, at(pbResent_w1=(0(1)3) female=1 minority=0 parentEdu=1) atmeans saving(marg, replace)

* plot contains predictive margins (black connected line plot) as well as distribution of observations for place-based resentment (gray shaded area histogram)

marginsplot, recast(connected) recastci(rcap) level(95) title("") xtitle("Place-Based Resentment", color(black) size(medium)) ylabel(-1(0.5)3) ymtick(-1(0.5)3) ytitle("Predicted Change in Internal Efficacy") xmtick(0(0)3) xlabel(0(1)3) plot1opts(lcolor(black) mcolor(black) bcolor(black)) ci1opt(color(black)) graphregion(color(white)) addplot(hist pbResent_w1, blcolor(dimgray) recast(rarea) fcolor(dimgray) percent yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 "0%" 25 "25%" 50 "50%" 75 "75%" 100 "100%", labcolor() axis(2) tlcolor(black) tlwidth(thick) labsize(small) tl(0)) ytitle("Percentage of Observations", axis(2)))

* also print results to Table 1
esttab m1, b(2) se(2) ar2 bic star(* 0.05)

* for interpretation, see how many students in high resentment bin are rural
tab pbResent_w1 geog_w1 if semester=="S24" & obsType==3


* for appendix, reestimate using continuous version
reg delta_ie ie_scale_w1 pbResent_w1 geog_w1 female minority parentEdu_w1 ///
pShigh gpa_combo i.instructor_final ///
if obsType==3 & semester=="S24"

eststo a1
esttab a1, b(2) se(2) ar2 bic star(* 0.05)

margins, at(pbResent_w1=(0(1)3) female=1 minority=0 parentEdu=1) atmeans saving(marg_alt, replace)

marginsplot, recast(connected) recastci(rcap) level(95) title("") xtitle("Place-Based Resentment", color(black) size(medium)) ylabel(-1(0.5)3) ymtick(-1(0.5)3) ytitle("Predicted Change in Internal Efficacy") xmtick(0(0)3) xlabel(0(1)3) plot1opts(lcolor(black) mcolor(black) bcolor(black)) ci1opt(color(black)) graphregion(color(white)) addplot(hist pbResent_w1, blcolor(dimgray) recast(rarea) fcolor(dimgray) percent yaxis(2) yscale(alt lcolor() axis(2)) ylabel(0 "0%" 25 "25%" 50 "50%" 75 "75%" 100 "100%", labcolor() axis(2) tlcolor(black) tlwidth(thick) labsize(small) tl(0)) ytitle("Percentage of Observations", axis(2)))
